package com.dragon.modules.yuegou.service.impl.member;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dragon.modules.yuegou.entity.member.TemplatePlatformEntity;
import com.dragon.modules.yuegou.mapper.member.TemplatePlatformMapper;
import com.dragon.modules.yuegou.model.member.TemplatePlatform;
import com.dragon.modules.yuegou.query.member.TemplatePlatformQuery;
import com.dragon.modules.yuegou.service.member.TemplatePlatformService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 会员卡应用平台 服务实现
 *
 * @author pbuilder generated
 * @date 2021-12-15 11:38:52
 * @version 2.0
 */
@Service("memTemplatePlatformService")
public class TemplatePlatformServiceImpl
		extends ServiceImpl<TemplatePlatformMapper, TemplatePlatformEntity>
		implements TemplatePlatformService {

	@Override
	public void saveTemplateFormList(String templateSetId, List<TemplatePlatform> platforms) {
		if(StringUtils.isNotBlank(templateSetId)) {
			TemplatePlatformQuery query = new TemplatePlatformQuery();
			query.setTemplateSetId(templateSetId);
			remove(query.toQueryWrapper());
		}
		for(TemplatePlatform platform : platforms) {
			save(platform);
		}
	}


}